NonEmptyArrayUnion

Operations over arrays that carry their non-emptiness in the type.

Specification

Kind
Union
Members
81
Examples
0
singletonSignature
NonEmptyArray.singleton value
ofArraySignature
NonEmptyArray.ofArray values
ofSeqSignature
NonEmptyArray.ofSeq values
ofListSignature
NonEmptyArray.ofList values
refinementSignature
NonEmptyArray.refinement ()

Summary

NameSignatureSynopsis
Union cases
ToArraythis.ToArrayReturns a copy of the refined value as a standard array.
Tailthis.TailReturns all items after the head.
Headthis.HeadReturns the first item.
Lengththis.LengthReturns the number of items, which is always at least one.
Operations
singletonNonEmptyArray.singleton valueBuilds an array of exactly one item.
ofArrayNonEmptyArray.ofArray valuesReturns the non-empty array, or None when the source is empty.
ofSeqNonEmptyArray.ofSeq valuesReturns the non-empty array, or None when the source is empty.
ofListNonEmptyArray.ofList valuesReturns the non-empty array, or None when the source is empty.
refinementNonEmptyArray.refinement ()Returns a refinement admitting any array with at least one item.
listRefinementNonEmptyArray.listRefinement ()Returns a refinement admitting a non-empty array from a list, which is the shape structured wire formats use.
createNonEmptyArray.create valuesAdmits a non-empty array, reporting the same failure the refinement does.
toArrayNonEmptyArray.toArray inputReturns a copy of the refined value as a standard array.
toListNonEmptyArray.toList inputReturns the refined value as a standard list.
toNonEmptyListNonEmptyArray.toNonEmptyList inputConverts to a non-empty list.
ofNonEmptyListNonEmptyArray.ofNonEmptyList inputConverts from a non-empty list.
headNonEmptyArray.head inputReturns the first item.
tailNonEmptyArray.tail inputReturns every item after the first.
lastNonEmptyArray.last inputReturns the final item.
lengthNonEmptyArray.length inputReturns the number of items as a plain int, matching Array.length.
mapNonEmptyArray.map mapping inputApplies a mapping to every item.
mapiNonEmptyArray.mapi mapping inputApplies an index-aware mapping to every item.
appendNonEmptyArray.append first secondConcatenates two non-empty arrays.
revNonEmptyArray.rev inputReverses the order of the items.
sortNonEmptyArray.sort inputSorts the items in ascending order.
sortByNonEmptyArray.sortBy projection inputSorts the items by a projected key.
sortWithNonEmptyArray.sortWith comparer inputSorts the items using an explicit comparison.
reduceNonEmptyArray.reduce reduction inputCombines every item with an associative operation.
foldNonEmptyArray.fold folder state inputFolds over the items from an explicit seed.
minNonEmptyArray.min inputReturns the smallest item.
maxNonEmptyArray.max inputReturns the largest item.
minByNonEmptyArray.minBy projection inputReturns the item with the smallest projected key.
maxByNonEmptyArray.maxBy projection inputReturns the item with the largest projected key.
filterNonEmptyArray.filter predicate inputFilters the items, returning a standard array because emptiness is possible.
tryFilterNonEmptyArray.tryFilter predicate inputFilters the items, returning None when nothing survives.
existsNonEmptyArray.exists predicate inputReturns whether any item satisfies the predicate.
forallNonEmptyArray.forall predicate inputReturns whether every item satisfies the predicate.
iterNonEmptyArray.iter action inputApplies an action to every item.
consToNonEmptyArray.consTo head inputPrepends an item to an already non-empty array.
indexedNonEmptyArray.indexed inputPairs every item with its index.
collectNonEmptyArray.collect mapping inputMaps each item to a non-empty array and concatenates the results.
concatNonEmptyArray.concat inputConcatenates a non-empty array of non-empty arrays.
sortDescendingNonEmptyArray.sortDescending inputSorts the items in descending order.
distinctNonEmptyArray.distinct inputRemoves duplicate items, preserving first-seen order.
zipNonEmptyArray.zip first secondPairs items positionally, truncating to the shorter input.
unzipNonEmptyArray.unzip inputSplits a non-empty array of pairs into a pair of non-empty arrays.
reduceBackNonEmptyArray.reduceBack reduction inputCombines every item from the right.
foldBackNonEmptyArray.foldBack folder input stateFolds over the items from the right.
partitionNonEmptyArray.partition predicate inputPartitions the items into matching and non-matching standard arrays.
containsNonEmptyArray.contains value inputReturns whether the array contains the item.
tryFindNonEmptyArray.tryFind predicate inputReturns the first matching item, if any.
toSeqNonEmptyArray.toSeq inputReturns the refined value as a sequence.
traverseResultNonEmptyArray.traverseResult mapping inputApplies a fallible mapping to every item, accumulating every failure rather than stopping at the first.
sequenceResultNonEmptyArray.sequenceResult inputCollects a non-empty array of results, accumulating every failure.
traverseOptionNonEmptyArray.traverseOption mapping inputApplies a mapping that may yield nothing, succeeding only when every item does.
sequenceOptionNonEmptyArray.sequenceOption inputCollects a non-empty array of options, succeeding only when every item is present.
groupByNonEmptyArray.groupBy projection inputGroups items by a key.
chunkBySizeNonEmptyArray.chunkBySize size inputSplits into consecutive runs of the given size, treating a size below one as one.
sumNonEmptyArray.sum inputAdds every item, matching Array.sum.
sumByNonEmptyArray.sumBy projection inputAdds a projection of every item, matching Array.sumBy.
averageNonEmptyArray.average inputAverages the items.
averageByNonEmptyArray.averageBy projection inputAverages a projection of the items.
countByNonEmptyArray.countBy projection inputCounts the items sharing each key.
scanNonEmptyArray.scan folder state inputRuns a fold and keeps every intermediate state, including the seed.
scanBackNonEmptyArray.scanBack folder input stateRuns a fold from the right and keeps every intermediate state.
tryFindBackNonEmptyArray.tryFindBack predicate inputReturns the last matching item, if any.
tryFindIndexNonEmptyArray.tryFindIndex predicate inputReturns the index of the first matching item, if any.
tryPickNonEmptyArray.tryPick chooser inputReturns the first item the chooser accepts, if any.
chooseNonEmptyArray.choose chooser inputKeeps the chosen items, returning a standard array because a chooser can reject every item.
tryChooseNonEmptyArray.tryChoose chooser inputKeeps the chosen items, returning None when nothing survives.
tryItemNonEmptyArray.tryItem index inputReturns the item at an index, or None when the index is out of range.
itemNonEmptyArray.item index inputReturns the item at an index, clamping the index into range.
truncateNonEmptyArray.truncate count inputKeeps at most the first count items, treating a count below one as one.
skipNonEmptyArray.skip count inputDrops the first count items, returning a standard array because skipping can consume everything.
pairwiseNonEmptyArray.pairwise inputPairs each item with its successor, returning a standard array — a single item yields none.
iteriNonEmptyArray.iteri action inputApplies an index-aware action to every item.
initNonEmptyArray.init count initialiserBuilds an array of count items from their indices, treating a count below one as one.
replicateNonEmptyArray.replicate count valueBuilds an array of count copies, treating a count below one as one.
sortByDescendingNonEmptyArray.sortByDescending projection inputSorts the items by a projected key, descending.
distinctByNonEmptyArray.distinctBy projection inputRemoves items sharing a projected key, keeping the first of each.
allPairsNonEmptyArray.allPairs first secondEvery pairing of an item from each array.
map2NonEmptyArray.map2 mapping first secondCombines items positionally, truncating to the shorter input.

Union cases

kind:member

ToArray

this.ToArray
Member
Returns a copy of the refined value as a standard array.

Returns

'value[]
kind:member

Tail

this.Tail
Member
Returns all items after the head.

Returns

'value[]
kind:member

Head

this.Head
Member
Returns the first item.

Returns

'value
kind:member

Length

this.Length
Member
Returns the number of items, which is always at least one.

Returns

int

Operations

kind:member

singleton

NonEmptyArray.singleton value
Member
Builds an array of exactly one item.

Parameters

NameTypeDescription
value'a

Returns

NonEmptyArray<'a>
kind:member

ofArray

NonEmptyArray.ofArray values
Member
Returns the non-empty array, or None when the source is empty.

Parameters

NameTypeDescription
values'value array

Returns

NonEmptyArray<'value> option
kind:member

ofSeq

NonEmptyArray.ofSeq values
Member
Returns the non-empty array, or None when the source is empty.

Parameters

NameTypeDescription
values'a seq

Returns

NonEmptyArray<'a> option
kind:member

ofList

NonEmptyArray.ofList values
Member
Returns the non-empty array, or None when the source is empty.

Parameters

NameTypeDescription
values'a list

Returns

NonEmptyArray<'a> option
kind:member

refinement

NonEmptyArray.refinement ()
Member
Returns a refinement admitting any array with at least one item.

Parameters

NameTypeDescription
unit

Returns

Refinement<'value array, NonEmptyArray<'value>>
kind:member

listRefinement

NonEmptyArray.listRefinement ()
Member
Returns a refinement admitting a non-empty array from a list, which is the shape structured wire formats use.

Parameters

NameTypeDescription
unit

Returns

Refinement<'value list, NonEmptyArray<'value>>
kind:member

create

NonEmptyArray.create values
Member
Admits a non-empty array, reporting the same failure the refinement does.

Parameters

NameTypeDescription
values'value seq

Returns

Result<NonEmptyArray<'value>, Violation>
kind:member

toArray

NonEmptyArray.toArray input
Member
Returns a copy of the refined value as a standard array.

Parameters

NameTypeDescription
inputNonEmptyArray<'value>

Returns

'value[]
kind:member

toList

NonEmptyArray.toList input
Member
Returns the refined value as a standard list.

Parameters

NameTypeDescription
inputNonEmptyArray<'value>

Returns

'value list
kind:member

toNonEmptyList

NonEmptyArray.toNonEmptyList input
Member
Converts to a non-empty list.

Parameters

NameTypeDescription
inputNonEmptyArray<'value>

Returns

NonEmptyList<'value>
kind:member

ofNonEmptyList

NonEmptyArray.ofNonEmptyList input
Member
Converts from a non-empty list.

Parameters

NameTypeDescription
inputNonEmptyList<'value>

Returns

NonEmptyArray<'value>
kind:member

head

NonEmptyArray.head input
Member
Returns the first item. Total.

Parameters

NameTypeDescription
inputNonEmptyArray<'value>

Returns

'value
kind:member

tail

NonEmptyArray.tail input
Member
Returns every item after the first.

Parameters

NameTypeDescription
inputNonEmptyArray<'value>

Returns

'value[]
kind:member

last

NonEmptyArray.last input
Member
Returns the final item. Total.

Parameters

NameTypeDescription
inputNonEmptyArray<'value>

Returns

'value
kind:member

length

NonEmptyArray.length input
Member
Returns the number of items as a plain int, matching Array.length.

Parameters

NameTypeDescription
inputNonEmptyArray<'value>

Returns

int
kind:member

map

NonEmptyArray.map mapping input
Member
Applies a mapping to every item. Non-emptiness is preserved.

Parameters

NameTypeDescription
mapping'value -> 'a
inputNonEmptyArray<'value>

Returns

NonEmptyArray<'a>
kind:member

mapi

NonEmptyArray.mapi mapping input
Member
Applies an index-aware mapping to every item. Non-emptiness is preserved.

Parameters

NameTypeDescription
mappingint -> 'value -> 'a
inputNonEmptyArray<'value>

Returns

NonEmptyArray<'a>
kind:member

append

NonEmptyArray.append first second
Member
Concatenates two non-empty arrays.

Parameters

NameTypeDescription
firstNonEmptyArray<'value>
secondNonEmptyArray<'value>

Returns

NonEmptyArray<'value>
kind:member

rev

NonEmptyArray.rev input
Member
Reverses the order of the items.

Parameters

NameTypeDescription
inputNonEmptyArray<'value>

Returns

NonEmptyArray<'value>
kind:member

sort

NonEmptyArray.sort input
Member
Sorts the items in ascending order.

Parameters

NameTypeDescription
inputNonEmptyArray<'value>

Returns

NonEmptyArray<'value>
kind:member

sortBy

NonEmptyArray.sortBy projection input
Member
Sorts the items by a projected key.

Parameters

NameTypeDescription
projection'value -> 'a
inputNonEmptyArray<'value>

Returns

NonEmptyArray<'value>
kind:member

sortWith

NonEmptyArray.sortWith comparer input
Member
Sorts the items using an explicit comparison.

Parameters

NameTypeDescription
comparer'value -> 'value -> int
inputNonEmptyArray<'value>

Returns

NonEmptyArray<'value>
kind:member

reduce

NonEmptyArray.reduce reduction input
Member
Combines every item with an associative operation. Total — no seed required.

Parameters

NameTypeDescription
reduction'value -> 'value -> 'value
inputNonEmptyArray<'value>

Returns

'value
kind:member

fold

NonEmptyArray.fold folder state input
Member
Folds over the items from an explicit seed.

Parameters

NameTypeDescription
folder'a -> 'value -> 'a
state'a
inputNonEmptyArray<'value>

Returns

'a
kind:member

min

NonEmptyArray.min input
Member
Returns the smallest item. Total.

Parameters

NameTypeDescription
inputNonEmptyArray<'value>

Returns

'value
kind:member

max

NonEmptyArray.max input
Member
Returns the largest item. Total.

Parameters

NameTypeDescription
inputNonEmptyArray<'value>

Returns

'value
kind:member

minBy

NonEmptyArray.minBy projection input
Member
Returns the item with the smallest projected key. Total.

Parameters

NameTypeDescription
projection'value -> 'a
inputNonEmptyArray<'value>

Returns

'value
kind:member

maxBy

NonEmptyArray.maxBy projection input
Member
Returns the item with the largest projected key. Total.

Parameters

NameTypeDescription
projection'value -> 'a
inputNonEmptyArray<'value>

Returns

'value
kind:member

filter

NonEmptyArray.filter predicate input
Member
Filters the items, returning a standard array because emptiness is possible.

Parameters

NameTypeDescription
predicate'value -> bool
inputNonEmptyArray<'value>

Returns

'value[]
kind:member

tryFilter

NonEmptyArray.tryFilter predicate input
Member
Filters the items, returning None when nothing survives.

Parameters

NameTypeDescription
predicate'a -> bool
inputNonEmptyArray<'a>

Returns

NonEmptyArray<'a> option
kind:member

exists

NonEmptyArray.exists predicate input
Member
Returns whether any item satisfies the predicate.

Parameters

NameTypeDescription
predicate'value -> bool
inputNonEmptyArray<'value>

Returns

bool
kind:member

forall

NonEmptyArray.forall predicate input
Member
Returns whether every item satisfies the predicate.

Parameters

NameTypeDescription
predicate'value -> bool
inputNonEmptyArray<'value>

Returns

bool
kind:member

iter

NonEmptyArray.iter action input
Member
Applies an action to every item.

Parameters

NameTypeDescription
action'value -> unit
inputNonEmptyArray<'value>

Returns

unit
kind:member

consTo

NonEmptyArray.consTo head input
Member
Prepends an item to an already non-empty array.

Parameters

NameTypeDescription
head'value
inputNonEmptyArray<'value>

Returns

NonEmptyArray<'value>
kind:member

indexed

NonEmptyArray.indexed input
Member
Pairs every item with its index. Non-emptiness is preserved.

Parameters

NameTypeDescription
inputNonEmptyArray<'value>

Returns

NonEmptyArray<int * 'value>
kind:member

collect

NonEmptyArray.collect mapping input
Member
Maps each item to a non-empty array and concatenates the results.

Parameters

NameTypeDescription
mapping'value -> NonEmptyArray<'result>
inputNonEmptyArray<'value>

Returns

NonEmptyArray<'result>
kind:member

concat

NonEmptyArray.concat input
Member
Concatenates a non-empty array of non-empty arrays.

Parameters

NameTypeDescription
inputNonEmptyArray<NonEmptyArray<'value>>

Returns

NonEmptyArray<'value>
kind:member

sortDescending

NonEmptyArray.sortDescending input
Member
Sorts the items in descending order.

Parameters

NameTypeDescription
inputNonEmptyArray<'value>

Returns

NonEmptyArray<'value>
kind:member

distinct

NonEmptyArray.distinct input
Member
Removes duplicate items, preserving first-seen order. Non-emptiness is preserved.

Parameters

NameTypeDescription
inputNonEmptyArray<'value>

Returns

NonEmptyArray<'value>
kind:member

zip

NonEmptyArray.zip first second
Member
Pairs items positionally, truncating to the shorter input. Total.

Parameters

NameTypeDescription
firstNonEmptyArray<'first>
secondNonEmptyArray<'second>

Returns

NonEmptyArray<'first * 'second>
kind:member

unzip

NonEmptyArray.unzip input
Member
Splits a non-empty array of pairs into a pair of non-empty arrays.

Parameters

NameTypeDescription
inputNonEmptyArray<'first * 'second>

Returns

NonEmptyArray<'first> * NonEmptyArray<'second>
kind:member

reduceBack

NonEmptyArray.reduceBack reduction input
Member
Combines every item from the right. Total — no seed required.

Parameters

NameTypeDescription
reduction'value -> 'value -> 'value
inputNonEmptyArray<'value>

Returns

'value
kind:member

foldBack

NonEmptyArray.foldBack folder input state
Member
Folds over the items from the right.

Parameters

NameTypeDescription
folder'value -> 'a -> 'a
inputNonEmptyArray<'value>
state'a

Returns

'a
kind:member

partition

NonEmptyArray.partition predicate input
Member
Partitions the items into matching and non-matching standard arrays.

Parameters

NameTypeDescription
predicate'value -> bool
inputNonEmptyArray<'value>

Returns

'value[] * 'value[]
kind:member

contains

NonEmptyArray.contains value input
Member
Returns whether the array contains the item.

Parameters

NameTypeDescription
value'value
inputNonEmptyArray<'value>

Returns

bool
kind:member

tryFind

NonEmptyArray.tryFind predicate input
Member
Returns the first matching item, if any.

Parameters

NameTypeDescription
predicate'value -> bool
inputNonEmptyArray<'value>

Returns

'value option
kind:member

toSeq

NonEmptyArray.toSeq input
Member
Returns the refined value as a sequence.

Parameters

NameTypeDescription
inputNonEmptyArray<'value>

Returns

'value seq
kind:member

traverseResult

NonEmptyArray.traverseResult mapping input
Member
Applies a fallible mapping to every item, accumulating every failure rather than stopping at the first.

Parameters

NameTypeDescription
mapping'value -> Result<'result, 'failure list>
inputNonEmptyArray<'value>

Returns

Result<NonEmptyArray<'result>, 'failure list>
kind:member

sequenceResult

NonEmptyArray.sequenceResult input
Member
Collects a non-empty array of results, accumulating every failure.

Parameters

NameTypeDescription
inputNonEmptyArray<Result<'value, 'failure list>>

Returns

Result<NonEmptyArray<'value>, 'failure list>
kind:member

traverseOption

NonEmptyArray.traverseOption mapping input
Member
Applies a mapping that may yield nothing, succeeding only when every item does.

Parameters

NameTypeDescription
mapping'value -> 'result option
inputNonEmptyArray<'value>

Returns

NonEmptyArray<'result> option
kind:member

sequenceOption

NonEmptyArray.sequenceOption input
Member
Collects a non-empty array of options, succeeding only when every item is present.

Parameters

NameTypeDescription
inputNonEmptyArray<'value option>

Returns

NonEmptyArray<'value> option
kind:member

groupBy

NonEmptyArray.groupBy projection input
Member
Groups items by a key. Every group is non-empty by construction.

Parameters

NameTypeDescription
projection'value -> 'a
inputNonEmptyArray<'value>

Returns

Map<'a, NonEmptyArray<'value>>
kind:member

chunkBySize

NonEmptyArray.chunkBySize size input
Member
Splits into consecutive runs of the given size, treating a size below one as one. Every chunk is non-empty.

Parameters

NameTypeDescription
sizeint
inputNonEmptyArray<'value>

Returns

NonEmptyArray<NonEmptyArray<'value>>
kind:member

sum

NonEmptyArray.sum input
Member
Adds every item, matching Array.sum.

Parameters

NameTypeDescription
inputNonEmptyArray<^value>

Returns

^value
kind:member

sumBy

NonEmptyArray.sumBy projection input
Member
Adds a projection of every item, matching Array.sumBy.

Parameters

NameTypeDescription
projection'value -> ^a
inputNonEmptyArray<'value>

Returns

^a
kind:member

average

NonEmptyArray.average input
Member
Averages the items. Total — the divisor is the length, which is always at least one, so unlike Array.average this cannot raise.

Parameters

NameTypeDescription
inputNonEmptyArray<^value>

Returns

^value
kind:member

averageBy

NonEmptyArray.averageBy projection input
Member
Averages a projection of the items. Total, for the same reason as average.

Parameters

NameTypeDescription
projection'value -> ^a
inputNonEmptyArray<'value>

Returns

^a
kind:member

countBy

NonEmptyArray.countBy projection input
Member
Counts the items sharing each key. Every count is at least one.

Parameters

NameTypeDescription
projection'value -> 'a
inputNonEmptyArray<'value>

Returns

Map<'a, int>
kind:member

scan

NonEmptyArray.scan folder state input
Member
Runs a fold and keeps every intermediate state, including the seed.

Parameters

NameTypeDescription
folder'a -> 'value -> 'a
state'a
inputNonEmptyArray<'value>

Returns

NonEmptyArray<'a>
kind:member

scanBack

NonEmptyArray.scanBack folder input state
Member
Runs a fold from the right and keeps every intermediate state.

Parameters

NameTypeDescription
folder'value -> 'a -> 'a
inputNonEmptyArray<'value>
state'a

Returns

NonEmptyArray<'a>
kind:member

tryFindBack

NonEmptyArray.tryFindBack predicate input
Member
Returns the last matching item, if any.

Parameters

NameTypeDescription
predicate'value -> bool
inputNonEmptyArray<'value>

Returns

'value option
kind:member

tryFindIndex

NonEmptyArray.tryFindIndex predicate input
Member
Returns the index of the first matching item, if any.

Parameters

NameTypeDescription
predicate'value -> bool
inputNonEmptyArray<'value>

Returns

int option
kind:member

tryPick

NonEmptyArray.tryPick chooser input
Member
Returns the first item the chooser accepts, if any.

Parameters

NameTypeDescription
chooser'value -> 'a option
inputNonEmptyArray<'value>

Returns

'a option
kind:member

choose

NonEmptyArray.choose chooser input
Member
Keeps the chosen items, returning a standard array because a chooser can reject every item.

Parameters

NameTypeDescription
chooser'value -> 'a option
inputNonEmptyArray<'value>

Returns

'a[]
kind:member

tryChoose

NonEmptyArray.tryChoose chooser input
Member
Keeps the chosen items, returning None when nothing survives.

Parameters

NameTypeDescription
chooser'a -> 'b option
inputNonEmptyArray<'a>

Returns

NonEmptyArray<'b> option
kind:member

tryItem

NonEmptyArray.tryItem index input
Member
Returns the item at an index, or None when the index is out of range.

Parameters

NameTypeDescription
indexint
inputNonEmptyArray<'value>

Returns

'value option
kind:member

item

NonEmptyArray.item index input
Member
Returns the item at an index, clamping the index into range. Total — index zero is always the head, so there is no empty case to report.

Parameters

NameTypeDescription
indexint
inputNonEmptyArray<'value>

Returns

'value
kind:member

truncate

NonEmptyArray.truncate count input
Member
Keeps at most the first count items, treating a count below one as one. Total, and non-emptiness is preserved — where Array.truncate 0 empties.

Parameters

NameTypeDescription
countint
inputNonEmptyArray<'value>

Returns

NonEmptyArray<'value>
kind:member

skip

NonEmptyArray.skip count input
Member
Drops the first count items, returning a standard array because skipping can consume everything. Total — a count past the end yields the empty array rather than raising the way Array.skip does.

Parameters

NameTypeDescription
countint
inputNonEmptyArray<'value>

Returns

'value[]
kind:member

pairwise

NonEmptyArray.pairwise input
Member
Pairs each item with its successor, returning a standard array — a single item yields none.

Parameters

NameTypeDescription
inputNonEmptyArray<'value>

Returns

('value * 'value)[]
kind:member

iteri

NonEmptyArray.iteri action input
Member
Applies an index-aware action to every item.

Parameters

NameTypeDescription
actionint -> 'value -> unit
inputNonEmptyArray<'value>

Returns

unit
kind:member

init

NonEmptyArray.init count initialiser
Member
Builds an array of count items from their indices, treating a count below one as one. Total, where Array.init 0 yields an empty array.

Parameters

NameTypeDescription
countint
initialiserint -> 'a

Returns

NonEmptyArray<'a>
kind:member

replicate

NonEmptyArray.replicate count value
Member
Builds an array of count copies, treating a count below one as one.

Parameters

NameTypeDescription
countint
value'a

Returns

NonEmptyArray<'a>
kind:member

sortByDescending

NonEmptyArray.sortByDescending projection input
Member
Sorts the items by a projected key, descending.

Parameters

NameTypeDescription
projection'value -> 'a
inputNonEmptyArray<'value>

Returns

NonEmptyArray<'value>
kind:member

distinctBy

NonEmptyArray.distinctBy projection input
Member
Removes items sharing a projected key, keeping the first of each. Non-emptiness is preserved.

Parameters

NameTypeDescription
projection'value -> 'a
inputNonEmptyArray<'value>

Returns

NonEmptyArray<'value>
kind:member

allPairs

NonEmptyArray.allPairs first second
Member
Every pairing of an item from each array. Non-emptiness is preserved.

Parameters

NameTypeDescription
firstNonEmptyArray<'first>
secondNonEmptyArray<'second>

Returns

NonEmptyArray<'first * 'second>
kind:member

map2

NonEmptyArray.map2 mapping first second
Member
Combines items positionally, truncating to the shorter input. Total — unlike Array.map2, which raises when the lengths differ.

Parameters

NameTypeDescription
mapping'first -> 'second -> 'a
firstNonEmptyArray<'first>
secondNonEmptyArray<'second>

Returns

NonEmptyArray<'a>